package main

import "fmt"

// 继承：解决代码的复用性和可维护性  满足  is-a
// 接口：设计好各种规范（方法） 只需满足  like -a  ,相比更加灵活，实现解耦
func main() {

	var s *Stu = &Stu{
		Name: "stu-zhangsan",
		Age:  15,
	}
	s.sayHello()
	s.speakEnglish()

	var p *Player = &Player{
		Name: "player-zhangsan",
	}
	p.sayHello()
	p.speakEnglish()

}

type Stu struct {
	Name string
	Age  int
}

func (s *Stu) sayHello() {
	fmt.Println((*s).Name, ":sayHello")
}

type Player struct {
	Name string
}

func (p *Player) sayHello() {
	fmt.Println((*p).Name, ":sayHello")
}

type LearnEnglish interface {
	speakEnglish()
}

func (p *Player) speakEnglish() {
	fmt.Println((*p).Name, ":speakEnglish")

}
func (s *Stu) speakEnglish() {
	fmt.Println((*s).Name, ":speakEnglish")
}
